<template>
    <div>
        <el-form label-width="180px">
            <el-form-item label="支付类型：">
                <el-radio-group v-model="payType">
                    <el-radio label="SWIPE">刷卡</el-radio>
                    <el-radio label="SCAN">扫码</el-radio>
                    <el-radio label="PUBLIC">公众号</el-radio>
                    <el-radio label="APPLET">小程序</el-radio>
                </el-radio-group>
            </el-form-item>
            <el-form-item label="客户端类型：">
                <el-radio-group v-model="appPayType">
                    <el-radio label="ALIPAY">支付宝</el-radio>
                    <el-radio label="WXPAY">微信</el-radio>
                </el-radio-group>
            </el-form-item>
            <el-form-item label="费率（可选）：">
                <el-input v-model="rateVal" placeholder="不填写则默认进件费率"></el-input>
            </el-form-item>
            <el-form-item>
                <el-button type="primary" @click="confirmOpen">开通支付</el-button>
            </el-form-item>
        </el-form>
    </div>
</template>
<script>
export default {
    props:{
        id:Number
    },
    data() {
        return {
            payType: '',
            appPayType: '',
            rateVal: ''
        }
    },
    methods: {
        confirmOpen() {
            if(this.appPayType==''||this.payType==''){
                this.$message.error('请填写完整')
            }
            let _this = this;
            this.$axios({
                url: '/admin/channel/other',
                data: {
                    type: 1,
                    userID: _this.id,
                    genre: 4,
                    payType:_this.payType,
                    appPayType:_this.appPayType,
                    value:_this.rateVal?_this.rateVal:''
                },
                success(res) {
                    if(res.data.code==200){
                        _this.$message({
                            message:res.data.msg,
                            type:'success'
                        });
                    }else{
                        _this.$message.error(res.data.msg);
                    }
                }
            });

        }
    }
}
</script>
<style scoped>
.el-input {
    width: 200px;
}
</style>